\subsection{authtest.c File Reference}
\label{authtest_8c}\index{authtest.c@{authtest.c}}


Test program for authentication functions.  


{\ttfamily \#include $<$stdio.h$>$}\par
{\ttfamily \#include $<$config.h$>$}\par
{\ttfamily \#include $<$auth.h$>$}\par
{\ttfamily \#include $<$sw.h$>$}\par
{\ttfamily \#include $<$fs.h$>$}\par
{\ttfamily \#include $<$hal.h$>$}\par
{\ttfamily \#include $<$transaction.h$>$}\par
{\ttfamily \#include $<$netinet/in.h$>$}\par
\subsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int {\bf main} (int argc, char $\ast$argv[$\,$])
\end{DoxyCompactItemize}
\subsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
{\bf iu8} {\bf authstate}
\begin{DoxyCompactList}\small\item\em Variable indicating current authentication state. \item\end{DoxyCompactList}\item 
{\bf iu32} {\bf challenge} [2]
\begin{DoxyCompactList}\small\item\em Value of the last with Get Challenge fetched random challenge. \item\end{DoxyCompactList}\item 
{\bf iu8} {\bf challvalidity}
\begin{DoxyCompactList}\small\item\em Validity of challenge. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsubsection{Detailed Description}
Test program for authentication functions. \begin{DoxyParagraph}{Id:}
\doxyref{authtest.c}{p.}{authtest_8c},v 1.11 2002/12/22 15:42:55 m Exp 
\end{DoxyParagraph}


\subsubsection{Function Documentation}
\index{authtest.c@{authtest.c}!main@{main}}
\index{main@{main}!authtest.c@{authtest.c}}
\paragraph[{main}]{\setlength{\rightskip}{0pt plus 5cm}int main (
\begin{DoxyParamCaption}
\item[{int}]{ argc, }
\item[{char $\ast$}]{ argv[$\,$]}
\end{DoxyParamCaption}
)}\hfill\label{authtest_8c_a0ddf1224851353fc92bfbff6f499fa97}


References auth\_\-createVerifyCryptogram(), auth\_\-init(), auth\_\-setPin(), auth\_\-verifyPin(), authstate, challenge, challvalidity, FALSE, fs\_\-init(), hal\_\-eeprom\_\-read(), hal\_\-init(), hal\_\-rnd\_\-getBlock(), PIN\_\-TYPE\_\-EXT, PIN\_\-TYPE\_\-PIN, PIN\_\-TYPE\_\-PUK, sw, and ta\_\-commit().



\subsubsection{Variable Documentation}
\index{authtest.c@{authtest.c}!authstate@{authstate}}
\index{authstate@{authstate}!authtest.c@{authtest.c}}
\paragraph[{authstate}]{\setlength{\rightskip}{0pt plus 5cm}{\bf iu8} {\bf authstate}}\hfill\label{authtest_8c_ac023311503326e98022248d8e937b837}


Variable indicating current authentication state. 

Single bit flags indicate, which authorization process has been successful. The flag is cleared, at the reset of the card and after unsuccessful authorization processes.

Valid flags are:


\begin{DoxyItemize}
\item AUTH\_\-FLAG\_\-PIN
\item AUTH\_\-FLAG\_\-KEY 
\end{DoxyItemize}\index{authtest.c@{authtest.c}!challenge@{challenge}}
\index{challenge@{challenge}!authtest.c@{authtest.c}}
\paragraph[{challenge}]{\setlength{\rightskip}{0pt plus 5cm}{\bf iu32} {\bf challenge}[2]}\hfill\label{authtest_8c_a5618de2390f5500a383c231b62c551c4}


Value of the last with Get Challenge fetched random challenge. 



Referenced by auth\_\-createVerifyCryptogram(), auth\_\-getChallenge(), and main().

\index{authtest.c@{authtest.c}!challvalidity@{challvalidity}}
\index{challvalidity@{challvalidity}!authtest.c@{authtest.c}}
\paragraph[{challvalidity}]{\setlength{\rightskip}{0pt plus 5cm}{\bf iu8} {\bf challvalidity}}\hfill\label{authtest_8c_add47c1a71dba136bb77c433df3b0914b}


Validity of challenge. 

The initial value if challvalidity is 2. This is decremented at the start of the command loop, so that it is 1 at the command following a Get Challenge. 

Referenced by auth\_\-createVerifyCryptogram(), auth\_\-getChallenge(), auth\_\-init(), and main().

